package com.hanhy.util;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

/**
 * Created by Administrator on 2016/12/26.
 * 页面中要定位的元素的封装
 * 其中：expression定位元素用到的表达式，waitSec为等待元素出现的时间，ByType为定位元素的方式
 */
public class Locator {

    private String expression = null;

    private int waitSec;

    public enum ByType{
        xpath,name,id,tagName,className,linkText,partialLinkText,cssSelector
    }
    private ByType byType;

    public Locator(){

    }
    public Locator(String expression){
        this.expression = expression;
        this.waitSec = 3;
        this.byType = ByType.xpath;
    }
    public Locator(String expression,int waitSec){
        this.expression= expression;
        this.waitSec = waitSec;
        this.byType = ByType.xpath;
    }
    public Locator(String expression,int waitSec,ByType byType){
        this.expression = expression;
        this.waitSec = waitSec;
        this.byType = byType;
    }

    public String getExpression(){
        return expression;
    }

    public ByType getByType(){
        return byType;
    }
    public int getWaitSec(){
        return waitSec;
    }

}

